/**
* ...
* @author Default
* @version 0.1
*/

package bdz.cms.vo{

	public class CategoryVO {
		public var id:Number;
		public var name:String;
		public var description:String;
		public var parent_id:Number;
		public var media:Array;
		public var contents:Array;
		public var sub:Array;
		public var order:Number;
		public function CategoryVO(xm:* = null) {
			if(xm is XML){
				id = Number(xm.cat_id); 
				name = xm.cat_name;
				description = xm.cat_desc;
				order = Number(xm.order);
				parent_id = Number(xm.parent_id);
				if (xm.content.data.length() > 0) {
					assignContentData(xm.content.data);
				}
				if (xm.media.data.length() > 0) {
					assignMediaData(xm.media.data);
				}
				if (xm.sub.data.length() > 0) {
					assignSubData(xm.sub.data);
				}
			}
		}
		private function assignSubData(xmres:XMLList):void {
			sub = new Array();
			for each(var xm:XML in xmres) {
				sub.push(new CategoryVO(xm));
			}
		}
		private function assignContentData(xmres:XMLList):void {
			contents = new Array();
			for each(var xm:XML in xmres) {
				contents.push(new ContentVO(xm));
			}
		}
		private function assignMediaData(xmres:XMLList):void {
			media = new Array();
			for each(var xm:XML in xmres) {
				media.push(new MediaVO(xm));
			}
		}
	}
	
}